home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / BNUM.H < prev    next >
C/C++ Source or Header  |  1991-12-28  |  2KB  |  54 lines

  1. /* Copyright (C) 1990 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* bnum.h */
  21. /* Interface to Level 2 number readers */
  22. /* Requires stream.h */
  23.  
  24. /* Homogenous number array formats. */
  25. /* The default for numbers is big-endian. */
  26. #define num_int32 0            /* [0..31] */
  27. #define num_int16 32            /* [32..47] */
  28. #define num_float 48
  29. #define num_float_IEEE num_float
  30. #define num_float_native (num_float + 1)
  31. #define num_msb 0
  32. #define num_lsb 128
  33. #define num_is_lsb(format) ((format) >= num_lsb)
  34. #define num_is_valid(format) (((format) & 127) <= 49)
  35. /* Special "format" for reading from an array */
  36. #define num_array 256
  37.  
  38. /* Test the byte ordering of numbers on a stream */
  39. #define s_is_lsb(s) num_is_lsb(s->num_format)
  40. #define s_is_msb(s) !s_is_lsb(s)
  41.  
  42. /* Read from an array or encoded number array */
  43. extern    int    sread_num_array(P2(stream *, ref *));
  44. extern    uint    scount_num_stream(P1(stream *));
  45. extern    int    sget_encoded_number(P2(stream *, ref *));
  46.  
  47. /* Get/put a number with appropriate byte swapping */
  48. extern    int    sgetshort(P2(stream *, short *));
  49. extern    void    sputshort(P2(stream *, short));
  50. extern    int    sgetlong(P2(stream *, long *));
  51. extern    void    sputlong(P2(stream *, long));
  52. extern    int    sgetfloat(P2(stream *, float *));
  53. extern    void    sputfloat(P2(stream *, floatp));
  54.